#include "header.h"
#include "rt.h"

static int				extend_supported(const char *name)
{
	const char			*extend = (const char *)glGetString(GL_EXTENSIONS);

	if (
#ifdef __glew_h__
		glewIsSupported(name)
#else
		strstr(extend, name) != NULL
#endif
		)
		return (1);
	else
	{
		fprintf(stderr, "Extend : %s isn't supported\n", name);
		return (0);
	}
}

int			extend_init(void)
{
	GLenum	err;

	if ((err = glewInit()) != GLEW_OK)
		return (error_msg("Glew", (const char *)glewGetErrorString(err), 0));
	if (!extend_supported("GL_ARB_shading_language_100") || !extend_supported("GL_ARB_shader_objects") ||
		!extend_supported("GL_ARB_vertex_shader") || !extend_supported("GL_ARB_fragment_shader"))
		return (error_msg("Glew", "Extension non supported", 0));
	return (1);
}